class Role < ActiveRecord::Base
  has_and_belongs_to_many :admin_users, class_name: 'Admin::User', :join_table => :admin_users_roles
  scopify

  validates :resource_type,
            :inclusion => { :in => Rolify.resource_types },
            :allow_nil => true

  validates :name, uniqueness: {scope: [:resource_id,:resource_type,:nick_name]}
end
